package Pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
/**定义统一响应标准 API，对服务端响应到客户端的数据进行统一标准设计*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class JesonResult implements Serializable {
    private static final long serialVersionUID = -1184281916297948359L;
    /**状态码设计*/
    private Integer state=1;//1-ok,0-error
    /**状态信息设计*/
    private String massage="ok";
    /**查询响应结果*/
    private Object data;

    public JesonResult(Throwable e){
        this.massage=e.getMessage();
        this.data=0;
    }

    public JesonResult(Object data) {
        this.data = data;
    }

    public JesonResult(String massage) {
        this.massage = massage;
    }

    public JesonResult(Integer state) {
        this.state = state;
    }
}
